package com.sdruixinggroup.mondayb2b.ui;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.sdruixinggroup.mondayb2b.R;
import com.sdruixinggroup.mondayb2b.adapter.QuickAdapter;
import com.sdruixinggroup.mondayb2b.models.NearbyShop;

/**
 * Created by tangjie on 2017/11/11.
 */

 public class MyAdapter extends QuickAdapter<NearbyShop.MerchantsBean.DataBean>{
    private Context context;
    public MyAdapter(Context context) {
        this.context=context;
    }


    @Override
    public int getLayoutID(int viewType) {
        return R.layout.item_layout;
    }

    @Override
    public void convert(VH holder, NearbyShop.MerchantsBean.DataBean itemData, int position) {
        ImageView itemImg = holder.getView(R.id.item_img);
        Glide.with(context).load(itemData.getThumb()).error(R.drawable.home_shop_one).into(itemImg);
        TextView tv_shopName = holder.getView(R.id.tv_shop_name);
        tv_shopName.setText(itemData.getName());
        TextView tvPhone = holder.getView(R.id.tv_phone);
        tvPhone.setText(itemData.getShopkeeper() +" · "+itemData.getPhone());
        TextView tv_sellCount = holder.getView(R.id.tv_sell_count);
        tv_sellCount.setText("已售"+itemData.getSaled_count()+"件");
        TextView tvDistance = holder.getView(R.id.tv_distance);
        tvDistance.setText(itemData.getDistance());
    }
}
